package com.example.canteen.converter;

import com.example.canteen.dao.User;
import com.example.canteen.dto.UserDTO;

public class UserConverter {
    public static UserDTO convertUser(User user) {
        UserDTO userDTO = new UserDTO();
        userDTO.setId(user.getId());
        userDTO.setUsername(user.getUsername());
        userDTO.setPassword(user.getPassword());
        userDTO.setType(user.getType());
        userDTO.setDepartment(user.getDepartment());
        return userDTO;
    }

    public static User convertUser(UserDTO userDTO) {
        User user = new User();
        user.setId(userDTO.getId());
        user.setUsername(userDTO.getUsername());
        user.setPassword(userDTO.getPassword());
        user.setType(userDTO.getType());
        user.setDepartment(userDTO.getDepartment());
        return user;
    }
}
